using System;
using System.Collections.Generic;
using PhillyCodeCamp.Domain;
using PhillyCodeCamp.DTO;
using PhillyCodeCamp.Infrastructure;
using PhillyCodeCamp.Mappers;

namespace PhillyCodeCamp.Services
{
    public class TaxService : ITaxService
    {
        private readonly ITaxReturnMapper _taxReturnMapper;

        public TaxService(): this (DependencyResolver.Resolve<ITaxReturnMapper>())
        {
        }

        public TaxService(ITaxReturnMapper taxReturnMapper)
        {
            _taxReturnMapper = taxReturnMapper;
        }

        public IList<ILookupDTO> GetListOfStates()
        {
            var states = new List<ILookupDTO>
                             {
                                 new LookupDTO("DE", "Delaware"),
                                 new LookupDTO("NJ", "New Jersey"),
                                 new LookupDTO("PA", "Pennsylvania")
                             };
            return states;
        }

        public decimal ComputeTax(TaxDataDTO taxDataDTO)
        {
            return _taxReturnMapper.MapTaxReturn(taxDataDTO).ComputeTax();
        }

    }
}